<template>
  <section class="centertask-box">
    <div class="corner-lb"></div>
    <div class="corner-rb"></div>
    <h3 class="task-title">
      资源调度分析
      <img class="icon" src="../../../../../assets/leftbg10.png" alt="" />
    </h3>
    <div class="centertask-num">
      <div class="ck-num">
        <p class="ck-titlt">日均起降次数</p>
        <div class="lefttask-text_box">
          <div class="lefttask-text" v-for="(item, index) in taskList.qj" :key="index">
            <div class="ck-con">
              <p>{{ item.name }}</p>
              <p class="ck-con-tit">{{ item.num > 0 ? item.num : 0 }}</p>
            </div>
            <ElProgress class="ck-progress" :percentage="item.num" :show-text="false"></ElProgress>
          </div>
        </div>
      </div>
      <div class="ck-battery">
        <p class="ck-titlt">日均飞行里程</p>
        <div class="lefttask-text_box">
          <div class="lefttask-text" :span="8" v-for="(item, index) in taskList.lc" :key="index">
            <div class="ck-con">
              <p>{{ item.name }}</p>
              <p class="ck-con-tit">{{ item.num }}</p>
            </div>
            <ElProgress class="ck-progress ck-progress1" :percentage="item.num" :show-text="false">
            </ElProgress>
          </div>
        </div>
      </div>
    </div>
  </section>
</template>
<script lang="ts" setup>
import { ref, onMounted, onBeforeUnmount } from "vue";
import { ElProgress } from "element-plus";
import { resourceScheduling } from '#/api/daping/airport'
const taskList = ref({
  qj: [],
  lc: []
});
const get_list = async () => {
  const { data } = await resourceScheduling({});
  // taskPage.value.total = data.total;
  taskList.value.qj = data.qj;
  taskList.value.lc = data.lc;
}
onMounted(() => {
  get_list()
})
</script>

<style lang="scss" scoped>
.centertask-box {
  margin: 0 0.5vh;
  // height: 34.5vh;
  height: 25vh;
  background: rgb(2 19 20 / 80%);
  border: 1px solid;
  border-image: radial-gradient(circle,
      rgb(36 229 241 / 17%),
      rgb(255 255 255 / 17%)) 1 1;
  position: relative;

  &::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0px;
    width: 22px;
    height: 22px;
    border-top: 1px solid #24e5f1;
    opacity: 0.4;
  }

  &::after {
    content: "";
    position: absolute;
    top: -1px;
    right: -1px;
    width: 22px;
    height: 22px;
    border-top: 1px solid #24e5f1;
    opacity: 0.4;
  }

  .corner-lb {
    content: "";
    position: absolute;
    bottom: -1px;
    left: -1px;
    width: 22px;
    height: 22px;
    border-bottom: 1px solid #24e5f1;
    border-left: 1px solid #24e5f1;
    opacity: 0.4;
  }

  .corner-rb {
    content: "";
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 22px;
    height: 22px;
    border-bottom: 1px solid #24e5f1;
    border-right: 1px solid #24e5f1;
    opacity: 0.4;
  }

  .task-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4vh;
    padding-left: 1.5vh;
    margin: 0;
    font-family: PingFangSC, "PingFang SC";
    font-size: 2vh;
    font-weight: 500;
    color: #fffefe;
    user-select: none;
    background: radial-gradient(ellipse 140% 300% at 100% 50%,
        rgba(1, 34, 35, 0.2) 28%,
        rgba(7, 217, 221, 0.7) 100%);

    .icon {
      width: 3vh;
      margin-right: 1vw;
    }
  }
}

.centertask-num {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-left: 3vh;
  height: calc(100% - 4vh);

  .ck-num {
    width: calc(50% - 1vw);
    height: 100%;
  }

  .ck-battery {
    height: 100%;
    width: calc(50% - 1vw);
  }

  .ck-con {
    display: flex;
    margin-bottom: 1vh;
    font-size: 1.6vh;
    // margin-left: 60px;

    p {
      font-size: 1.6vh;
      // height: 30px;
      // line-height: 30px;
      font-weight: 400;
      color: #fff;
    }

    .ck-con-tit {
      margin-left: 1vh;
    }
  }
}

.ck-progress {
  width: calc(90%);
  height: 1vh;
  // :deep(.el-progress-bar__outer) {
  //   background: #1b3738;
  //   border-radius: 4px;

  //   .el-progress-bar__inner {
  //     background:
  //       radial-gradient(10% 0% at 0% 0%, #020c0d 0%, #00faff 0%), #00faff;
  //     border: 1px solid;
  //     border-radius: 4px;
  //     border-image: radial-gradient(circle,
  //         rgb(4 39 42 / 17%),
  //         rgb(0 240 255 / 17%)) 1 1;
  //   }
  // }

  :deep(.el-progress-bar__outer) {
    border-radius: 0.5vh;
    background: #1B3738;
    height: 1vh !important;
  }

  :deep(.el-progress-bar__inner) {
    border-radius: 0.5vh;
    background: radial-gradient(ellipse 100% 150% at 100% 50%,
        rgba(36, 229, 241, 1) 28%,
        rgba(36, 229, 241, 0) 100%);
    height: 1vh !important;
  }

  :deep(.el-progress__text) {
    font-size: 0.8vw !important;
    margin-left: 0.2vw;
    min-width: 2vw;
  }
}

.ck-progress1 {
  :deep(.el-progress-bar__inner) {
    background: radial-gradient(ellipse 100% 150% at 100% 50%,
        rgb(238, 194, 26) 28%,
        rgba(238, 194, 26, 0) 100%);
  }
}

.ck-titlt {
  height: 5vh;
  display: flex;
  align-items: center;
  font-size: 1.8vh;
  font-weight: 500;
  color: #fff;
}

.lefttask-text_box {
  height: calc(100% - 5vh);
  overflow: auto;
}

.lefttask-text {
  margin-bottom: 0.5vh;
}
</style>
